<template lang='pug'>
  div
    router-link.link(v-for="(item, index) in list" tag="div" :key="'link-' + index" :to="item.path") {{ item.content }}
</template>

<script>
export default {
  data: () => ({
    list: [
      {
        path: '/css-shape',
        content: "css-形状"
      },
      {
        path: '/css-placeholder-shown',
        content: 'css-placeholder-shown'
      },
      {
        path: '/css-animation-wave',
        content: '正在加载中...'
      },
      {
        path: '/css-animation-2',
        content: 'we must unite against COVID2020'
      },
      {
        path: '/lazylaod',
        content: 'lazylaod'
      }
    ]
  }),
  created() {
    console.log(`无限累加 函数 sum(2,4,234,23,4,234,2).valueof() => ${this.sum(2,4,234,23,4,23, 4,2).valueof()}`)
  },
  methods: {
    sum(...args) {
      const fn = (...count) => sum(...args, ...count)

      let len = args.length
      while(len) {
        if (typeof args[len - 1] !== 'number') {
          console.error(`${args[len - 1]} type is error`)
          // throw new Error(`${args[len - 1]} type is error`)
        }
        len --
      }
      fn.valueof = () => args.reduce((acc, curr) => acc + curr, 0)

      return fn
    }
  }
}
</script>

<style lang="stylus" scoped>
.link
  color green
  text-decoration underline
  cursor progress
  link-height 1.4
.linkhover
  color yellowgreen
</style>
